#!/bin/bash

# by defualt, awk command prints full record, the result is equalvalent to 'cat':

# - print full content of input file 
awk '{print}' ./test_employee.txt
echo -e '\n'

# - use $n n is a number to print specific field
awk -F ',' '{print $2}' ./test_employee.txt # print all employees' name 
echo -e '\n'



# Pattern Matching

# use /pattern/ to matching the lines to be processed

# - prints the names and title of the Managers
awk -F ',' '/Manager/ {print $2, $3}' ./test_employee.txt
echo -e '\n'

# - add additional text when output 
awk -F ',' '/^102/ {print "Emp id 102 is", $2}' ./test_employee.txt
echo -e '\n'
